<style>
    #dictItem-update {
        padding: 20px 25px 25px 0;
    }

    #dictItem-update .layui-treeSelect .ztree li a, .ztree li span {
        margin: 0 0 2px 3px !important;
    }
</style>
<div class="layui-fluid" id="dictItem-update">
    <form class="layui-form" action="" lay-filter="dictItem-update-form">
        <div class="layui-form-item zzdz-hide ">
            <label class="layui-form-label zzdz-form-item-require">item主键：</label>
            <div class="layui-input-block">
                <input type="text" name="id" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label zzdz-form-item-require">所属字典：</label>
            <div class="layui-input-block">
                <select id="dictId-select" name="dictId"></select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label zzdz-form-item-require">Item名称：</label>
            <div class="layui-input-block">
                <input type="text" name="lable" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label zzdz-form-item-require">Item值：</label>
            <div class="layui-input-block">
                <input type="text" name="value" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label zzdz-form-item">描述：</label>
            <div class="layui-input-block">
                <input type="text" name="description" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label zzdz-form-item">备注：</label>
            <div class="layui-input-block">
                <input type="text" name="remarks" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label zzdz-form-item">排序：</label>
            <div class="layui-input-block">
                <input type="text" name="sort" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item zzdz-hide">
            <button class="layui-btn" lay-submit="" lay-filter="dictItem-update-form-submit" id="submit"></button>
        </div>
    </form>
</div>

<script data-th-inline="javascript">
    layui.use(['zzdz', 'form', "formSelect"], function () {
        var $ = layui.$,
            zzdz = layui.zzdz,
            layer = layui.layer,
            form = layui.form,
            $view = $('#dictItem-update'),
            formSelect = layui.formSelect,
            dictIdSelect = $view.find('#dictId-select'),
            dictItem = [[${dictItem}]];
        form.render();
        <!-- 自定义下拉选择模块 -->
        formSelect.render(ctx + "common/select/dict", $, $view, form, dictIdSelect, dictItem.dictId);
        initDictItemValue();

        function initDictItemValue() {
            form.val("dictItem-update-form", {
                "id": dictItem.id,
                "dictId": dictItem.dictId,
                "value": dictItem.value,
                "lable": dictItem.lable,
                "type": dictItem.type,
                "description": dictItem.description,
                "remarks": dictItem.remarks,
                "sort": dictItem.sort,
            });
        }

        form.on('submit(dictItem-update-form-submit)', function (data) {
            if (zzdz.nativeEqual(data.field, dictItem)) {
                zzdz.alert.warn('数据未作任何修改！');
                return false;
            }
            zzdz.post(ctx + 'dictItem/update', data.field, function () {
                layer.closeAll();
                zzdz.alert.success(dictItem.type + ' 字典-子表数据修改成功');
                $('#zzdz-dictItem').find('#query').click();
            });
            return false;
        });
    });
</script>